<?php

use app\helpers\AppHelper;
use app\models\Book;
use app\models\UserFavorite;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\web\View;

/* @var $this View */

$items = UserFavorite::getFavorites();
?>
<div class="popover-container">
    <div class="panel">
        <h5 class="panel-header">我的书架</h5>
        <div class="panel-body">
            <?php if(!empty($items)): ?>
            <div class="columns">
                <?php foreach ($items as $k => $item): ?>
                    <div class="column col-4 col-sm-6">
                        <a class="overlay favorite-image" href="<?= Url::to(['comic/detail', 'id' => $item['id']]); ?>"><img alt="<?= Html::encode($item['book']['title']); ?>" src="<?= AppHelper::formatImage($item['book']['thumbnail']); ?>" class="img-responsive">
                            <div class="overlay-panel text-ellipsis">
                                <span><?= Html::encode($item['book']['title']); ?></span>
                            </div>
                        </a>
                    </div>
                <?php endforeach; ?>
            </div>
            <?php else: ?>
            <h4 class="empty">书架空空如也</h4>
            <?php endif; ?>
        </div>
    </div>
</div>



